package cn.tom.basic.exception;

/**
 * 错误码封装：将整个系统所有错误信息和错误码进行封装 - 方便维护
 */
public enum StatusCode {

    SUCCESS(2000, "OK"),
    LOGIN_SUCCESS(2001, "登录成功"),
    OPERATION_SUCCESS(2002, "操作成功"),

    UNAUTHORIZED(4000, "未登录或登录过期"),
    LOGIN_EXCEPTION(4001, "账号异常"),
    ACCOUNT_EXCEPTION(4002, "账号异常"),
    ACCOUNT_ERROR(4003, "用户名或密码错误"),
    PARAM_VERIFICATION_FAILED(4004, "参数校验失败"),

    SYSTEM_ERROR(5000,"系统内部错误"),
    OPERATION_FAILED(5001, "操作失败"),
    VALIDATE_ERROR(5002, "请求参数错误"),
    USERNAME_ALREADY_EXISTS(5003, "用户名被占用"),
    DATA_NOT_FOUND(5004, "请求数据不存在"),
    DEPT_SELECT_ERROR(5005,"上级部门选择错误：不能选自己或下级部门"),

    VERIFYCODE_ERROR(6000, "验证码错误"),
    VERIFYCODE_EXPIRED(6001, "验证码过期"),
    VERIFYCODE_CREATE_ERROR(6002, "验证码生成失败"),
    VERIFYCODE_NOT_VALID(6004, "验证码无效"),
    VERIFYCODE_NOT_EMPTY(6006, "验证码不能为空");

    // 增加通用性状态码
    public static final int BUSINESS_ERROR_CODE = 4000;

    //状态码、状态码描述
    private Integer code;
    private String message;
    private StatusCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }
}
